<?php
namespace app\admin\controller;

use app\admin\module\GoodsModule;
use app\BaseController;
use app\Request;

class Goods extends BaseController{

    public function index(Request $request){
        $pageSize = $request->param('pageSize',10);
        $data = GoodsModule::page($pageSize);
        return $this->success('获取成功',$data);
    }

    public function create(Request $request){
        $data = $request->post();
        GoodsModule::create($data);
        return $this->success("新增成功");
    }

    public function update(Request $request){
        $data = $request->post();
        GoodsModule::update($data);
        return $this->success('更新成功');
    }

    public function remove(Request $request){
        $id = $request->param('id');
        GoodsModule::del($id);
    }
}